// import { Navigate, useLocation } from 'react-router-dom';

// import User from '../../users/user';
// import RouteMapManager from '../services/route-map-manager';

// /**
//  * https://github.com/remix-run/react-router/blob/dev/examples/auth/src/App.tsx
//  */
// function RequireAuth({ route, currentUser, children }: { route: string, currentUser: User | null, children: Element }) {

//   const location = useLocation();

//   if (!RouteMapManager.checkCanActivateRoute(route, currentUser)) {
//     // Redirect them to the /login page, but save the current location they were
//     // trying to go to when they were redirected. This allows us to send them
//     // along to that page after they login, which is a nicer user experience
//     // than dropping them off on the home page.
//     return <Navigate to="/login" state={{ from: location }} replace />;
//   }

//   return children;
// }
